package com.demo.dubbo.facade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.demo.dubbo.api.DemoFacade;
import com.demo.dubbo.api.ReqDTO;
import com.demo.dubbo.api.ResDTO;
import com.demo.helloworld.bo.User;
import com.demo.helloworld.logic.SayHelloLogic;
import com.outstanding.framework.bootstrap.SystemPropertyConfigure;
import com.outstanding.framework.core.PendingException;
import com.outstanding.framework.core.ReturnCode;
import com.outstanding.framework.plugin.dubbo.OutstandingFacade;



//属于Dubbo的@Service注解，非Spring  作用：暴露服务
/**
 *不一定需要版本号，如果带上了版本号，则消费者也必须带上版本号 
 *
 */
@Service()  
public class DemoFacadeImpl extends OutstandingFacade implements DemoFacade{
	
	@Autowired
	private SayHelloLogic logic;
	
	
	public ResDTO get(ReqDTO dto) throws PendingException {
		User user = new User();
		user.setName(dto.getName());
		ReturnCode rc = logic.commit(user);
		ResDTO resDto = new ResDTO();
		resDto.setApp(SystemPropertyConfigure.getAPPName());
		resDto.setMsgCd(rc.getCode());
		resDto.setMsgInf(rc.getMessage());
		return resDto;
	}

}
